package org.deltaset.meta.internal;

import java.util.List;
import java.util.logging.Logger;
import org.deltaset.meta.MetaAction;
import org.deltaset.meta.MetaEntry;
import org.deltaset.meta.MetaField;
import org.deltaset.meta.annotation.DsViewType;

/**
 *
 * @author dmakariev
 */
class MetaEntryImpl implements MetaEntry {

    private static final Logger logger = Logger.getLogger(MetaEntryImpl.class.getName());
    private final MetaClass metaClass;

    MetaEntryImpl(final MetaClass metaClass) {
        this.metaClass = metaClass;
    }
    
    

    private MetaClass getMetaClass() {
        return metaClass;
    }

    @Override
    public Class getEntityClass() {
        return this.getMetaClass().getEntityClass();
    }

    //////////
    @Override
    public List<MetaAction> getOtherActions() {
        return this.getMetaClass().getGroup(MetaActionGroupType.OTHER);
    }

    @Override
    public List<MetaAction> getOtherContextActions() {
        return this.getMetaClass().getGroup(MetaActionGroupType.OTHER_CONTEXT);
    }

    @Override
    public List<MetaAction> getFinderActions() {
        return this.getMetaClass().getGroup(MetaActionGroupType.FINDER);
    }

    @Override
    public List<MetaAction> getFactoryActions() {
        return this.getMetaClass().getGroup(MetaActionGroupType.FACTORY);
    }

    @Override
    public List<MetaAction> getContextActions() {
        return this.getMetaClass().getGroup(MetaActionGroupType.CONTEXT);
    }

    @Override
    public List<MetaField> getListFields() {
        return this.getMetaClass().orderedFieldsFor(DsViewType.LIST);
    }

    @Override
    public List<MetaField> getDetailFields() {
        return this.getMetaClass().orderedFieldsFor(DsViewType.DETAIL);
    }

    @Override
    public List<MetaField> getFormFields() {
        return this.getMetaClass().orderedFieldsFor(DsViewType.FORM);
    }

    @Override
    public MetaAction getDefaultFinder() {
        return this.getMetaClass().getDefaultFinder();
    }

    @Override
    public MetaAction getFindByIdAction() {
       return this.getMetaClass().getFindByIdAction();
    }
    
    
}
